#ifndef  xRenderQueue_h_h_h_h_h
#define  xRenderQueue_h_h_h_h_h


#include "XDefine.h"
#include "xRenderEntry.h"
#define  MaxRenderEntyNumber 1024

namespace XE	
{


	class XRenderSystem;
	class xRenderObject;
	class xCamera;

	typedef std::vector<xRenderObject*>xRenderObjectVector;


	enum xRenderQueueLevel
	{
		xRQL_BACK_LEVEL = 0,
		xRQL_BAK_SKY_LEVEL,
		xRQL_WORLD1_LEVEL,
		xRQL_WORLD2_LEVEL,
		xRQL_WORLD3_LEVEL,
		xRQL_FRONT_SKY_LEVEL,
		xRQL_UI_LEVEL,

		xRQL_MAX_LEVEL,

	};


	enum xActiveSateBit
	{
	     Active_Shader = 0,
		 Active_Technique,
		 Active_Pass,

	};



	 int  RenderComp(const void* v0,const void* v1);


	class XClass xRenderQueue
	{

		class XClass xRenderQueueListen
		{
		public:
		  virtual	void PreRender(XRenderSystem* pRenderSystem,xCamera* pCamera ) = 0;

		  virtual	 void PostRender(XRenderSystem* pRenderSystem,xCamera* pCamera ) = 0;
		};

	public:

		xRenderQueue(xRenderQueueLevel level );

		virtual ~xRenderQueue();

		void Clear();

		HRESULT Render(XRenderSystem* pRenderSystem,xCamera* pCamera );

		virtual void Sort();

        void AddRenderObject(xRenderObject* pRenderObj);

		bool SetListen(xRenderQueueListen* pListen);

		xRenderEntry* GetNextRenderEntry();

		


	protected:


		virtual HRESULT  RenderImplement(XRenderSystem* pRenderSyste,xCamera* pCamera );
       
       xRenderQueueLevel m_RenderLevel;

	   xRenderObjectVector m_RenderObjectVector;

	   xRenderQueueListen* m_Listen;

	   typedef std::vector<xRenderEntry> xRenderEntryVector;
	   typedef std::vector<xRenderEntry*> xRenderEntryPtrVector;
	   xRenderEntryVector m_RenderEntry;
	   xRenderEntryPtrVector m_RenderEntryPtr;

	   uint16  m_UserEntry;


	};





}



#endif